<template>
  <div class="cl">
    <header-nav :index_num="index_num"></header-nav>
    <div id="excute_box">
      <!--内容-->
      <div class="excute_con">
        <h3>一、项目申报书</h3>
        <p>
          <a :href="getsubs.probook" target="_blank">{{shili?shili:'示例文字.DOC'}}</a>
          <a :href="getsubs.probook" target="_blank">预览</a>
        </p>
        <h3>二、项目实施方案</h3>
        <p>
          <a :href="getsubs.fangan" target="_blank">{{shili1?shili1:'示例文字.DOC'}}</a>
          <a :href="getsubs.fangan" target="_blank">预览</a>
        </p>
        <h3>三、中期报告</h3>
        <h3>1、基本信息</h3>
        <aside>
          <div class="writeinfo">
            <label>项目名称:</label>
            <el-input
              v-model="getsubs.name"
              name="company"
              style="width:350px"
              required
              class="shuru"
            ></el-input>
            <!-- <input type="text" name="company" v-model="getsubs.name" value disabled required /> -->
          </div>
          <div class="writeinfo">
            <label>机构名称:</label>
            <el-input
              v-model="getsubs.company"
              name="name"
              style="width:350px"
              required
              class="shuru"
            ></el-input>
            <!-- <input
              type="text"
              name="name"
              value
              v-model="getsubs.company"
              disabled
              required
              class="division"
            />-->
          </div>
          <div class="writeinfo">
            <label>申请日期:</label>
            <!-- <input type="date" name="aterm" v-model="starttime"  required />
            <el-date-picker v-model="starttime"></el-date-picker>
            <span>至</span>
            <input type="date" name="fterm" v-model="endtime" value required />
            <el-date-picker v-mode="endtime"></el-date-picker>-->
            <el-date-picker
              v-model="visitDate"
              type="daterange"
              @change="getTime"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              class="shuru"
            ></el-date-picker>
          </div>
          <div>
            <h3>项目执行团队人员构成及分工:</h3>
            <div class="rich">
              <!-- <team @team1="team1" :teamVal="teamval"></team> -->
              <inform @inform="inform2" :informVal="informVal"></inform>
            </div>
            <!-- <input
              type="text"
              name="share"
              value
              v-model="team"
              required
              class="division"
            />-->
          </div>
        </aside>
        <div class="mid_box">
          <h3>2.项目发展性状况</h3>
          <div class="rich">
            <inform @inform="inform" :informVal="informVal"></inform>
          </div>
        </div>
        <div class="mid_box">
          <h3>3、项目实施情况</h3>
          <h3>3.1项目目标</h3>
          <div class="rich">
            <goals @goals="goals" :goalsVal="goalsVal"></goals>
          </div>
        </div>
        <div class="mid_box">
          <h3>3.2项目活动</h3>
          <div class="rich">
            <projects @projects="projects" :projectsVal="projectsVal"></projects>
          </div>
        </div>
        <div class="mid_box">
          <h3>3.3项目中期完成目标与活动对照表</h3>
          <div class="rich">
            <comtab @comtab="comtab" :comtabVal="comtabVal"></comtab>
          </div>
        </div>
        <div class="mid_box">
          <h3>4、项目取得的成效</h3>
          <h3>4.1项目活动</h3>
          <div class="rich">
            <effect @effect="effect" :effectVal="effectVal"></effect>
          </div>
        </div>
        <div class="mid_box">
          <h3>4.2项目产生的其他重要影响</h3>
          <div class="rich">
            <resona @resona="resona" :resonaVal="resonaVal"></resona>
          </div>
        </div>
        <div class="mid_box">
          <h3>4.3媒体报道</h3>
          <div class="rich">
            <release @release="release" :releaseVal="releaseVal"></release>
          </div>
        </div>
        <div class="mid_box">
          <h3>5、项目实施至今的情况总结</h3>
          <div class="rich">
            <plement @plement="plement" :plementVal="plementVal"></plement>
          </div>
        </div>
        <div class="mid_box">
          <h3>6、项目财务报告（按实际支出列出明细，上传文件）</h3>
          <el-upload
            class="avatar-uploader"
            :action="$upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess"
            :before-upload="beforeAvatarUpload"
          >
            <img v-if="imageUrl" :src="imageUrl" class="avatar" />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
           <a class="filename" :href="fileurl"> {{filename}}</a>
          <div @click="beforeRemove1(filename,'imageUrl')" v-if="imageUrl">
            <i class="el-icon-close close"></i>
          </div>
          <!--文件上传-->
        </div>
        <div class="mid_box">
          <h3>7、中期电子报告上传</h3>
          <el-upload
            class="avatar-uploader"
            :action="$upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess1"
            :before-upload="beforeAvatarUpload"
          >
            <img v-if="imageUrl1" :src="imageUrl1" class="avatar" />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <a class="filename" :href="fileurl1"> {{filename1}}</a>
          <!--文件上传-->
          <div @click="beforeRemove1(filename1,'imageUrl1')" v-if="imageUrl1">
            <i class="el-icon-close close"></i>
          </div>
        </div>
        <div class="mid_box">
          <h3>四、项目调整申请表及批复意见表（若无项目调整，此项材料就不需要提交）</h3>
          <el-upload
            class="avatar-uploader"
            :action="$upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess2"
            :before-upload="beforeAvatarUpload"
          >
            <img v-if="imageUrl2" :src="imageUrl2" class="avatar" />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <a class="filename" :href="fileurl2"> {{filename2}}</a>
            <div @click="beforeRemove1(filename2,'imageUrl2')" v-if="imageUrl2">
            <i class="el-icon-close close"></i>
          </div>
          <!--文件上传-->
        </div>
        <div class="mid_box">
          <div style="display:flex">
            <h3>
              五、活动类/培训类/会议类材料：【以下内容基于但不限于】签到表、活动方案或内容、活动反馈(反馈记录或反馈表)、活动照片
              或视频培训课件、媒体报导等(原则上体现两点：活动实际发生&活动效果)
            </h3>
            <el-button type="primary" plain style="height:40px;margin-top:51px" @click="add">添加</el-button>
          </div>

          <div v-for="(i,j) in ziliaoarr" :key="j" class="activebox">
            <span>活动{{j+1}}:</span>
            <el-input
              v-model="name[j]"
              name="activity"
              style="width:750px"
              required
              class="midsion"
            ></el-input>
            <!-- <input type="text" name="activity" value v-model="name[j]" required class="midsion" /> -->
            <div @click="active1(j)">
              <el-upload
                class="avatar-uploader activeup"
                :action="$upload"
                :show-file-list="false"
                :on-success="handleAvatarSuccess3"
                :before-upload="beforeAvatarUpload"
              >
                <img v-if="i!=1&&i" :src="i" class="avatar" />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
               <a class="filename" :href="urls[j]"> {{filenamearr[j]}}</a>
                <div @click="beforeRemove1('','imageUrl3',j)" v-if="i.length">
                <i class="el-icon-close close" style="left:140px;top:-107"></i>
              </div>
              <!--文件上传-->
            </div>
          </div>
        </div>
        <div class="mid_box">
          <h3>六、上传财务中期预算表</h3>
          <el-upload
            class="avatar-uploader"
            :action="$upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess4"
            :before-upload="beforeAvatarUpload"
          >
            <img v-if="imageUrl4" :src="imageUrl4" class="avatar" />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <a class="filename" :href="fileurl4"> {{filename4}}</a>
            <div @click="beforeRemove1(filename4,'imageUrl4')" v-if="imageUrl4">
            <i class="el-icon-close close"></i>
          </div>
          <!--文件上传-->
        </div>
        <div class="mid_box">
          <h3>七、其他类(请依据项目书内容产出进行交付，例如：实物产出物、调研报告等)</h3>
          <el-upload
            class="avatar-uploader"
            :action="$upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess5"
            :before-upload="beforeAvatarUpload"
          >
            <img v-if="imageUrl5" :src="imageUrl5" class="avatar" />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
            <a class="filename" :href="fileurl5"> {{filename5}}</a>
            <div @click="beforeRemove1(filename5,'imageUrl5')" v-if="imageUrl5">
            <i class="el-icon-close close"></i>
          </div>
          <!--文件上传-->
        </div>
        <div class="mid_box">
          <h3>八、中期PTT文件上传</h3>
          <el-upload
            class="avatar-uploader"
            :action="$upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess6"
            :before-upload="beforeAvatarUpload"
          >
            <img v-if="imageUrl6" :src="imageUrl6" class="avatar" />
            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
          </el-upload>
          <a class="filename" :href="fileurl6"> {{filename6}}</a>
            <div @click="beforeRemove1(filename6,'imageUrl6')" v-if="imageUrl6">
            <i class="el-icon-close close"></i>
          </div>
          <!--文件上传-->
        </div>
        <!-- <div class="ll">
                <button type="button" @click="submit(0)">保存</button>
                <button type="submit" @click="submit(1)">提交</button>
        </div>-->
        <div class="ll">
          <el-form
            v-model="numberValidateForm"
            ref="numberValidateForm"
            label-width="100px"
            class="demo-ruleForm"
          >
            <el-form-item>
              <button type="button" @click="postApply(0)">保存</button>
              <button type="button" @click="postApply(1)" class="tj">提交</button>
            </el-form-item>
          </el-form>
        </div>
      </div>
    </div>
    <footer-nav class="footer"></footer-nav>
  </div>
</template>
<script>
const path = require("path");
const files = require.context("@/components", false, /\.vue$/);
const modules = {};
files.keys().forEach(key => {
  const names = path.basename(key, ".vue");
  modules[names] = files(key).default || files(key);
});

export default {
  components: modules,
  props: {},
  data() {
    return {
      index_num: 2,
      sub: 0,
      informText: "",
      informVal: "",
      projectsText: "",
      projectsVal: "",
      golasText: "",
      golasVal: "",
      comtabText: "",
      comtabVal: "",
      effectText: "",
      effectVal: "",
      resonaText: "",
      resonaVal: "",
      releaseText: "",
      releaseVal: "",
      plementText: "",
      plementVal: "",
      imageUrl: "",
      company: "",
      share: "",
      activity: "",
      numberValidateForm: "",
      uploadForm: new FormData(),
      getsubs: null,
      subStatus: 0,
      project_id: 83,
      people: "",
      develop: "",
      pro_condition: "",
      result: "",
      summary: "",
      fina: "",
      elereport: "",
      adjust: "",
      ziliao: "",
      budget: "",
      other: "",
      PPT: "",
      org_name: "",
      goalsVal: "",
      visitDate: [],
      team: "",
      teamval: "",
      infomrText: "",
      imageUrl: "",
      imageUrl1: "",
      imageUrl2: "",
      imageUrl3: [],
      imageUrl4: "",
      imageUrl5: "",
      imageUrl6: "",
      fileurl: "",
      fileurl1: "",
      fileurl2: "",
      fileurl3: [{ name: "", elereport: "" }],
      fileurl4: "",
      fileurl5: "",
      fileurl6: "",
      filename: "",
      filename1: "",
      filename2: "",
      filename3: "",
      filename4: "",
      filename5: "",
      filename6: "",
      shili: "",
      shili1: "",
      ziliaoarr: [1],
      name: [],
      urls: [],
      teamtext: "aaa",
      urlno: 0,
      chooseurl: [],
      urlorder: [],
      filetype: [],
      picarr: [],
      filenamearr:[],
    };
  },
  computed: {},
  watch: {
    ziliaoarr() {
      for (let i in this.ziliaoarr) {
        // this.urls[i] = "";
        // this.imageUrl3[i]=""
        // this.filetype[i]=""
      }
    },
    imageUrl3() {},
    filetype() {
      // for(let i in this.filetype){
      //   console.log(this.filetype[i],"7946")
      //   if(this.filetype[i]=="docx"){
      //     this.imageUrl3[i]="/static/img/word.png"
      //   }else if(this.filetype[i]="pptx"){
      //     this.imageUrl3[i]="/static/img/ppt.png"
      //   }else if(this.filetype[i]=="pdf"){
      //      this.imageUrl3[i]="/static/img/pdf.jpg"
      //   }else if(this.filetype[i]="xls"){
      //     this.imageUrl3[i]="/static/img/excel.png"
      //   }
      // }
      //             for (let i in this.ziliaoarr) {
      //   for (let m in this.filetype) {
      //     if (m == i) {
      //       //    if (file.response.data.extension == "docx") {
      //       //    this.$set(this.ziliaoarr, i, "/static/img/word.png");
      //       // } else if (file.response.data.extension == "pptx") {
      //       //    this.$set(this.ziliaoarr, i,  "/static/img/ppt.png");
      //       // } else if (file.response.data.extension == "pdf") {
      //       //   // this.imageUrl3[x] = "/static/img/pdf.jpg";
      //       //   this.$set(this.ziliaoarr, i,  "/static/img/pdf.jpg");
      //       // } else if (file.response.data.extension == "xls") {
      //       //   // this.imageUrl3[x] = "/static/img/excel.png";
      //       //     this.$set(this.ziliaoarr, i,  "/static/img/excel.png");
      //       // }
      //       this.$set(this.ziliaoarr, i, this.imageUrl3[m]);
      //       // this.ziliaoarr[i]=this.imageUrl3[m]
      //     }
      //   }
      // }
    }
  },
  methods: {
    beforeRemove1(e, f, g) {
      console.log(e);
      console.log(f, "remove");
      if (e.length) {
        this.$confirm(`确定移除 ${e} ?`).then(() => {
          // this.handleRemove1()
          switch (f) {
            case "imageUrl":
              this.imageUrl = "";
              break;
            case "imageUrl1":
              this.imageUrl1 = "";
              break;
            case "imageUrl2":
              this.imageUrl2 = "";
              break;
            case "imageUrl3":
              this.imageUrl3 = "";
              break;
            case "imageUrl4":
              this.imageUrl4 = "";
              break;
            case "imageUrl5":
              this.imageUrl5 = "";
              break;
            case "imageUrl5":
              this.imageUrl5 = "";
              break;
            case "imageUrl6":
              this.imageUrl6 = "";
              break;
            case "imageUrl6":
              this.imageUrl6 = "";
              break;
            case "imageUrl8":
              this.imageUrl8 = "";
              break;
            case "imageUrl9":
              this.imageUrl9 = "";
              break;
            case "imageUrl10":
              this.imageUrl10 = "";
              break;
            default:
              break;
          }
          console.log("zzz");
        });
      } else {
        this.$confirm(`删除文件后将无法恢复，请谨慎操作`).then(() => {
          // this.handleRemove1()
          switch (f) {
            case "imageUrl3":
              console.log(g, "kkk");
              this.imageUrl3[g] = "";
              this.ziliaoarr[g] = "";
              this.filetype[g] = "";
              for (let i in this.filetype) {
                // console.log(this.filetype[i],"7946")
                if (this.filetype[i] == "docx" || this.filetype[i] == "doc") {
                  this.imageUrl3[i] = "/static/img/word.png";
                } else if (
                  this.filetype[i] == "pptx" ||
                  this.filetype[i] == "ppt"
                ) {
                  this.imageUrl3[i] = "/static/img/ppt.png";
                } else if (this.filetype[i] == "pdf") {
                  this.imageUrl3[i] = "/static/img/pdf.jpg";
                } else if (
                  this.filetype[i] == "xls" ||
                  this.filetype[i] == "xlsx"
                ) {
                  this.imageUrl3[i] = "/static/img/excel.png";
                } else if (
                  this.filetype[i] == "jpg" ||
                  this.filetype[i] == "jpeg" ||
                  this.filetype[i] == "png"
                ) {
                  this.imageUrl3[this.urlno] = file.response.data.url;
                  // this.imageUrl7[i] = file.response.data.url;
                }
              }

              for (let i in this.ziliaoarr) {
                for (let m in this.imageUrl3) {
                  if (m == i) {
                    this.$set(this.ziliaoarr, i, this.imageUrl3[m]);
                    // this.ziliaoarr[i]=this.imageUrl3[m]
                  }
                }
              }
              break;
            default:
              break;
          }
          console.log("mmmm");
        });
      }

      return;
    },
    add() {
      this.ziliaoarr.push(1);
    },
    active1(m) {
      // console.log(m)
      this.chooseurl.push(m);
      this.urlno = m;
      //  this.chooseurl[this.urlorder]=m
    },
    getTime() {},
    team1(data) {
      console.log(data, "data");
      this.teamtext = data;
    },
    inform(data) {
      console.log(data, "e");
      this.infomrText = data;
    },
    inform2(data) {
      console.log(data, "111111e");
      this.team = data;
    },
    projects(data) {
      this.projectsText = data;
    },
    goals(data) {
      this.goalsText = data;
    },
    comtab(data) {
      this.comtabText = data;
    },
    effect(data) {
      this.effectText = data;
    },
    resona(data) {
      this.resonaText = data;
    },
    release(data) {
      this.releaseText = data;
    },
    plement(data) {
      this.plementText = data;
    },
    handleAvatarSuccess(res, file) {
      this.fileurl = file.response.data.url;
      // this.imageUrl =  file.ressponse.data.url;
      this.filename = file.response.data.name;
      if (
        file.response.data.extension == "docx" ||
        file.response.data.extension == "doc"
      ) {
        this.imageUrl = "/static/img/word.png";
      } else if (
        file.response.data.extension == "pptx" ||
        file.response.data.extension == "ppt"
      ) {
        this.imageUrl = "/static/img/ppt.png";
      } else if (file.response.data.extension == "pdf") {
        this.imageUrl = "/static/img/pdf.jpg";
      } else if (
        file.response.data.extension == "xls" ||
        file.response.data.extension == "xlsx"
      ) {
        this.imageUrl = "/static/img/excel.png";
      } else if (
        file.response.data.extension == "jpg" ||
        file.response.data.extension == "jpeg" ||
        file.response.data.extension == "png"
      ) {
        this.imageUrl = file.response.data.url;
      }
    },
    handleAvatarSuccess1(res, file) {
      this.fileurl1 = file.response.data.url;
      // this.imageUrl1 = file.response.data.url;
      if (
        file.response.data.extension == "doc" ||
        file.response.data.extension == "docx"
      ) {
        this.imageUrl1 = "/static/img/word.png";
      } else if (
        file.response.data.extension == "pptx" ||
        file.response.data.extension == "ppt"
      ) {
        this.imageUrl1 = "/static/img/ppt.png";
      } else if (file.response.data.extension == "pdf") {
        this.imageUrl1 = "/static/img/pdf.jpg";
      } else if (
        file.response.data.extension == "xls" ||
        file.response.data.extension == "xlsx"
      ) {
        this.imageUrl1 = "/static/img/excel.png";
      } else if (
        file.response.data.extension == "jpg" ||
        file.response.data.extension == "jpeg" ||
        file.response.data.extension == "png"
      ) {
        this.imageUrl1 = file.response.data.url;
      }
      this.filename1 = file.response.data.name;
      // this.imageUrl = URL.createObjectURL(file.raw);
    },
    handleAvatarSuccess2(res, file) {
      // this.imageUrl = URL.createObjectURL(file.raw);
      this.fileurl2 = file.response.data.url;
      // this.imageUrl2 = file.response.data.url;
      if (
        file.response.data.extension == "doc" ||
        file.response.data.extension == "docx"
      ) {
        this.imageUrl2 = "/static/img/word.png";
      } else if (
        file.response.data.extension == "pptx" ||
        file.response.data.extension == "ppt"
      ) {
        this.imageUrl2 = "/static/img/ppt.png";
      } else if (file.response.data.extension == "pdf") {
        this.imageUrl2 = "/static/img/pdf.jpg";
      } else if (
        file.response.data.extension == "xls" ||
        file.response.data.extension == "xlsx"
      ) {
        this.imageUrl2 = "/static/img/excel.png";
      } else if (
        file.response.data.extension == "jpg" ||
        file.response.data.extension == "jpeg" ||
        file.response.data.extension == "png"
      ) {
        this.imageUrl2 = file.response.data.url;
      }
      this.filename2 = file.response.data.name;
    },
    handleAvatarSuccess3(res, file) {
      console.log(file);
      console.log(file.response.data.url);
      // this.fileurl3 = file.response.data.url;
      // this.imageUrl3 =file.response.data.url;
      // this.fileurl3[i].elereport
      this.chooseurl = Array.from(new Set(this.chooseurl));
      for (let i in this.chooseurl) {
        // console.log(this.chooseurl[i], "asaa");
        // console.log(this.urls)
        // for (let m in this.urls) {
        //   console.log(m)
        //   if (this.chooseurl[i] == m) {
        //     console.log("urlsｍｍｍｍ")
        //     this.urls[m] = file.response.data.url;
        // if (file.response.data.extension == "docx") {
        //   this.imageUrl3[m] = "/static/img/word.png";
        // } else if (file.response.data.extension == "pptx") {
        //   this.imageUrl3[m] = "/static/img/ppt.png";
        // } else if (file.response.data.extension == "pdf") {
        //   this.imageUrl3[m] = "/static/img/pdf.jpg";
        // } else if (file.response.data.extension == "xls") {
        //   this.imageUrl3[m] = "/static/img/excel.png";
        // }
        // }
        // }
        //   for(let x in this.imageUrl3){
        //     if(this.chooseurl[i]==x){
        //         if (file.response.data.extension == "docx") {
        //   this.imageUrl3[x] = "/static/img/word.png";
        // } else if (file.response.data.extension == "pptx") {
        //   this.imageUrl3[x] = "/static/img/ppt.png";
        // } else if (file.response.data.extension == "pdf") {
        //   this.imageUrl3[x] = "/static/img/pdf.jpg";
        // } else if (file.response.data.extension == "xls") {
        //   this.imageUrl3[x] = "/static/img/excel.png";
        // }
        //     }
        // }
      }
      console.log(file.response.data.extension, 502);
      this.filetype[this.urlno] = file.response.data.extension;
      this.urls[this.urlno] = file.response.data.url;
       this.filenamearr[this.urlno] = file.response.data.name;
      //  for(let n in this.filetype){
      //       if(this.urlno==n){
      //         this.filetype[n]=file.response.data.extension
      //       }
      //     }
      for (let i in this.filetype) {
        // console.log(this.filetype[i],"7946")
        if (this.filetype[i] == "docx" || this.filetype[i] == "doc") {
          this.imageUrl3[i] = "/static/img/word.png";
        } else if (this.filetype[i] == "pptx" || this.filetype[i] == "ppt") {
          this.imageUrl3[i] = "/static/img/ppt.png";
        } else if (this.filetype[i] == "pdf") {
          this.imageUrl3[i] = "/static/img/pdf.jpg";
        } else if (this.filetype[i] == "xls" || this.filetype[i] == "xlsx") {
          this.imageUrl3[i] = "/static/img/excel.png";
        } else if (
          this.filetype[i] == "jpg" ||
          this.filetype[i] == "jpeg" ||
          this.filetype[i] == "png"
        ) {
          this.imageUrl3[this.urlno] = file.response.data.url;
          // this.imageUrl3=this.urls
        }
      }
      for (let i in this.ziliaoarr) {
        for (let m in this.imageUrl3) {
          if (m == i) {
            this.$set(this.ziliaoarr, i, this.imageUrl3[m]);
            // this.ziliaoarr[i]=this.imageUrl3[m]
          }
        }
      }
      console.log(this.imageUrl3, "imgurl3");
      console.log(this.filetype, "filetype");
      // for(let i in this.urls){
      //   if(i==this.urlno){
      //     this.urls[i]=file.response.data.url
      //   }
      // }
      // this.urls.push(file.response.data.url)
      // this.filename13 = file.response.data.name;

      // this.imageUrl = URL.createObjectURL(file.raw);
    },
    handleAvatarSuccess4(res, file) {
      this.fileurl4 = file.response.data.url;
      // this.imageUrl4 = file.response.data.url;
      if (
        file.response.data.extension == "docx" ||
        file.response.data.extension == "doc"
      ) {
        this.imageUrl4 = "/static/img/word.png";
      } else if (
        file.response.data.extension == "pptx" ||
        file.response.data.extension == "ppt"
      ) {
        this.imageUrl4 = "/static/img/ppt.png";
      } else if (file.response.data.extension == "pdf") {
        this.imageUrl4 = "/static/img/pdf.jpg";
      } else if (
        file.response.data.extension == "xls" ||
        file.response.data.extension == "xlsx"
      ) {
        this.imageUrl4 = "/static/img/excel.png";
      } else if (
        file.response.data.extension == "jpg" ||
        file.response.data.extension == "jpeg" ||
        file.response.data.extension == "png"
      ) {
        this.imageUrl4 = file.response.data.url;
      }
      this.filename4 = file.response.data.name;
      // this.imageUrl = URL.createObjectURL(file.raw);
    },
    handleAvatarSuccess5(res, file) {
      this.fileurl5 = file.response.data.url;
      // this.imageUrl5 = file.response.data.url;
      if (
        file.response.data.extension == "docx" ||
        file.response.data.extension == "doc"
      ) {
        this.imageUrl5 = "/static/img/word.png";
      } else if (
        file.response.data.extension == "pptx" ||
        file.response.data.extension == "ppt"
      ) {
        this.imageUrl5 = "/static/img/ppt.png";
      } else if (file.response.data.extension == "pdf") {
        this.imageUrl5 = "/static/img/pdf.jpg";
      } else if (
        file.response.data.extension == "xls" ||
        file.response.data.extension == "xlsx"
      ) {
        this.imageUrl5 = "/static/img/excel.png";
      } else if (
        file.response.data.extension == "jpg" ||
        file.response.data.extension == "jpeg" ||
        file.response.data.extension == "png"
      ) {
        this.imageUrl5 = file.response.data.url;
      }
      this.filename5 = file.response.data.name;
      // this.imageUrl = URL.createObjectURL(file.raw);
    },
    handleAvatarSuccess6(res, file) {
      this.fileurl6 = file.response.data.url;
      // this.imageUrl6 = file.response.data.url;
      if (
        file.response.data.extension == "docx" ||
        file.response.data.extension == "doc"
      ) {
        this.imageUrl6 = "/static/img/word.png";
      } else if (
        file.response.data.extension == "pptx" ||
        file.response.data.extension == "ppt"
      ) {
        this.imageUrl6 = "/static/img/ppt.png";
      } else if (file.response.data.extension == "pdf") {
        this.imageUrl6 = "/static/img/pdf.jpg";
      } else if (
        file.response.data.extension == "xls" ||
        file.response.data.extension == "xlsx"
      ) {
        this.imageUrl6 = "/static/img/excel.png";
      } else if (
        file.response.data.extension == "jpg" ||
        file.response.data.extension == "jpeg" ||
        file.response.data.extension == "png"
      ) {
        this.imageUrl6 = file.response.data.url;
      }
      this.filename6 = file.response.data.name;
      // this.imageUrl = URL.createObjectURL(file.raw);
    },
    beforeAvatarUpload(file) {
      // const isJPG = file.type === "image/jpeg";
      // const isLt2M = file.size / 1024 / 1024 < 2;
      // if (!isJPG) {
      //   this.$message.error("上传头像图片只能是 JPG 格式!");
      // }
      // if (!isLt2M) {
      //   this.$message.error("上传头像图片大小不能超过 2MB!");
      // }
      // return isJPG && isLt2M;
    },
    buttonForm(formName) {
      // this.$refs[formName].validate((valid) => {
      //   if (valid) {
      //     alert('submit!');
      //   } else {
      //     console.log('error submit!!');
      //     return false;
      //   }
      // });
      alert("保存成功");
    },
    getSubmis() {
      let t = this;
      console.log(t.$route.query.id, "aa");
      this.$http({
        method: "get",
        url: "v1/test/center",
        params: {
          id: this.$route.query.id
        }
      })
        .then(res => {
          // console.log(res.data.code)
          console.log(res, 888);
          if (res.data.code === 200) {
            this.getsubs = res.data.data.data;
            var date = new Date(parseInt(this.getsubs.aterm) * 1000);
            let Y = date.getFullYear().toString() + "-";
            let M =
              (date.getMonth() + 1 < 10
                ? "0" + (date.getMonth() + 1)
                : date.getMonth() + 1) + "-";
            let D = date.getDate() + " ";
            console.log(Y + M + D);
            console.log(this.getsubs);
            this.visitDate[0] = Y + M + D;

            var date1 = new Date(parseInt(this.getsubs.fterm) * 1000);
            let Y1 = date1.getFullYear().toString() + "-";
            let M1 =
              (date1.getMonth() + 1 < 10
                ? "0" + (date1.getMonth() + 1)
                : date1.getMonth() + 1) + "-";
            let D1 = date1.getDate() + " ";
            console.log(Y1 + M1 + D1);
            console.log(this.getsubs);
            this.visitDate[1] = Y1 + M1 + D1;

            let shili = res.data.data.data.probook;
            // var filename = shili.substring(shili.lastIndexOf('/')+1);
            // console.log(filename)
            this.shili = shili.substring(shili.lastIndexOf("/") + 1);

            let shili1 = res.data.data.data.fangan;
            this.shili1 = shili1.substring(shili.lastIndexOf("/") + 1);
          } else {
            alert(res.data.msg);
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    postApply(index) {
      console.log(this.getsubs);
      console.log(this.name, 144215);
      console.log(this.teamtext, 88858758);
      console.log(this.urls, "の");
      console.log(this.chooseurl, "url233");
      console.log(this.ziliaoarr);
      for (let i in this.ziliaoarr) {
        this.fileurl3[i] = { name: "", elereport: "" };
        if (this.name[i]) {
          this.fileurl3[i].name = this.name[i];
        }
        if (this.urls[i]) {
          this.fileurl3[i].elereport = this.urls[i];
        }
      }
      console.log(this.fileurl3, "额");

      //     if(this.fileurl3.length==1){
      //       for(let i  in this.name){
      //         this.fileurl3[i]={name:"",elereport:""}
      //         this.fileurl3[i].name=this.name[i]
      //         if(this.urls.length){
      // this.fileurl3[i].elereport=this.urls[i]
      //         }else{
      //           this.fileurl3[i].elereport=""
      //         }

      //       }
      //       }else{
      //           for(let i  in this.fileurl3){
      //               this.fileurl3[i]={name:"",elereport:""}
      //         this.fileurl3[i].name=this.name[i]
      //         this.fileurl3[i].elereport=this.urls[i]
      //       }
      //       }

      this.$http({
        method: "post",
        url: "v1/test/cent-sub",
        data: {
          subStatus: index,
          project_id: this.id,
          org_name: this.getsubs.company,
          people: this.team,
          develop: this.goalsText,
          pro_condition: this.projectsText,
          result: this.effectText,
          summary: this.plementText,
          fina: this.fileurl,
          elereport: this.fileurl1,
          adjust: this.fileurl2,
          // ziliao: this.fileurl3,
          ziliao: JSON.stringify(this.fileurl3),
          budget: this.fileurl4,
          other: this.fileurl5,
          PPT: this.fileurl6
        }
      })
        .then(res => {
          console.log(res);
          if (res.data.data.code == 200) {
            this.$message({
              message: res.data.data.msg,
              type: "success"
            });
            this.$router.push({
              name: "project"
            });
          } else {
            this.$message.error(res.data.data.msg);
          }
        })
        .catch(err => {
          console.log(err);
        });
    }
  },
  created() {
    console.log(this.$route.query, "bba");
    this.id = this.$route.query.id;
    this.getSubmis();
    // this.postApply()
  }
};
</script>
<style lang="scss" scoped>
.close {
  position: relative;
  top: -114px;
  z-index: 999;
  left: 110px;
}
.tj {
  background-image: linear-gradient(
      69deg,
      #cc263f 0%,
      #f42b47 100%,
      #ed162d 100%,
      #e60012 100%
    ),
    linear-gradient(#e60012, #e60012);
}
.writeinfo {
  margin-bottom: 20px;
}
.shuru {
  margin-left: 25px;
}
.activebox {
  margin-bottom: 30px;
}
.activeup {
  margin-left: 45px;
}
.rich {
  z-index: 10;
  width: 100%;
  // margin: 30px auto 0px;
  margin-bottom: 30px;
  margin-top: 10px;
  height: 320px;
}
#excute_box {
  width: 100%;
  .excute_con {
    width: 1200px;
    margin: 0 auto;
    padding: 80px 30px;
    h3 {
      line-height: 260%;
      font-size: 20px;
    }
    p a {
      line-height: 10%;
      color: #7471ef;
      font-size: 14px;
      margin-right: 10px;
    }
    label {
      margin-left: 16px;
      font-family: "MicrosoftYaHei";
      font-size: 14px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 25px;
      letter-spacing: 0px;
      color: #333333;
      text-align: right;
      display: inline-block;
      width: 200px;
    }
    input {
      box-sizing: border-box;
      width: 33.8%;
      height: 35px;
      background-color: #ffffff;
      border: solid 1px #c7c7c7;
      outline: none;
      margin-left: 35px;
      margin-bottom: 15px;
      font-family: "MicrosoftYaHei";
      font-size: 18px;
      font-weight: normal;
      font-stretch: normal;
      letter-spacing: 0px;
      color: #323232;
      margin-right: 35px;
    }
    .division {
      width: 76%;
    }
    .midsion {
      width: 80%;
      margin-left: 3px;
      margin-bottom: 10px;
    }
    span {
      font-size: 18px;
    }
    span a {
      color: #7471ef;
    }
    p {
      font-size: 17px;
      color: #666;
      line-height: 30px;
    }
    .download {
      color: #7471ef;
      padding-left: 30px;
      font-size: 14px;
    }
  }
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409eff;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 100px;
    height: 100px;
    line-height: 100px;
    text-align: center;
    border: 1.5px dashed #666;
  }
  .avatar {
    width: 100px;
    height: 100px;
    display: block;
  }
  .mid_box span {
    font-size: 14px;
  }
  .ll {
    margin-top: 80px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;

    button[type="button"] {
      margin-right: 152px;
      width: 197px;
      height: 63px;
      background-color: #ff9800;
      border-radius: 5px;
      font-family: "MicrosoftYaHei";
      font-size: 26px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 63px;
      letter-spacing: 0px;
      color: #ffffff;
      text-align: center;
      outline: none;
      border: 0;
    }

    button[type="submit"] {
      width: 197px;
      height: 63px;
      background-color: #e60012;
      border-radius: 5px;
      font-family: "MicrosoftYaHei";
      font-size: 26px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 63px;
      text-align: center;
      letter-spacing: 0px;
      color: #ffffff;
      outline: none;
      border: 0;
    }
  }
}
</style>
